<!DOCTYPE html>
<html>

<head lang="en">
    <title>找攻略</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategyComment.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.js"></script>
    <!--<link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">-->
    <!--<script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>-->
    <script src="/js/common.js"></script>

    <script>
        $(function () {
            var params = getParams();
            if (!params.id) {
                return;
            }
            //获取点评的de 信息
            $.get('/strategies/comments/' + params.id, function (data) {
                console.log(data);
                $(".comment").renderValues(data, {
                    getImg: function (item, value) {
                        console.log(data);
                        //用分号切开 图片的平均
                        var str = value.split(';');
                        str.pop();
                        var img = "";
                        for (var i = 0; i < str.length; i++) {
                            img += '<li><img src="' + str[i] + '"></li>'
                        }

                        $(item).html(img);
                    }, //星星
                    getStar: function (item, value) {
                        var star = "";
                        var stars = "";
                        for (var i = 0; i < value; i++) {
                            star += '<i class="fa fa-star"></i>'
                        }
                        for (var i = 0; i<5 - value; i++) {
                            stars += '<i class="fa fa-star-o"></i>'
                        }
                        $(item).html(star + stars);

                    }
                });
                    //给a链接绑定事件
                $(".comment-link a[data-url]").click(function () {
                    var url = $(this).data('url');
                    var id = $(this).data('id');
                    window.location.href = url+id;

                });
            })
            $(".sendBtn").click(function () {
                $("#commentSend").submit();
            })
        })
    </script>


</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="/index.html">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>点评详情</span>
        </div>
        <div class="col"></div>
    </div>
</div>

<div class="comment">


    <div class="container">
        <div class="row">
            <div class="col-2 comment-head">
                <a href="mine/userProfiles.html" data-id="user_id">
                    <img class="rounded-circle" render-src="user.headImgUrl">
                </a>
                <button class="btn" id="followBtn"><i class="fa fa-hand-o-right"> </i> 关注</button>
            </div>
            <div class="col">
                <span class="comment-star" render-key="starNum" render-fun="getStar"></span>

                <span class="comment-date" render-html="createTime"></span>
                <div class="comment-content" >
                    <p render-html="content"></p>
                </div>
                <ul class="comment-img"  render-key="imgUrls" render-fun="getImg">
                </ul>

                <div class="comment-link">
                    <a href="javascript:;" data-url="strategyCatalogs.html?strategyId="
                       render-attr="data-id=strategy.id">
                        <input type="hidden" render-html="strategy.id">
                        <img render-src="strategy.coverUrl"> <span render-html="strategy.title"></span>
                        <i class="fa fa-angle-right fa-2x"></i>
                    </a>
                </div>


            </div>
        </div>
    </div>

    <div class="count d-flex justify-content-between">
        <div class="p-2 commentSpeak">评论<span></span></div>
        <div class="p-2">赞<span>0</span></div>
       
    </div>

</div>

<div class="comment-list">
    快来发表你的评论吧
</div>

<div class="operation">
    <div class="d-flex justify-content-between">
        <form method="post" id="commentSend"  >
        <div class="p-2">
            <input  class="form-control" name="content" id="content" placeholder="请输入发送内容">
            <i class="fa fa-commenting-o">
             </i> 添加你的评论</div>
        <p class="btn btn-success sendBtn">发送</p>
        <div class="p-2"><i class="fa fa-star-o"></i> 收藏</div>
        </form>
    </div>
</div>


</body>

</html>